package cn.melon.view.admin.roll.ctr;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import cn.melon.mod.roll.RollInfo;
import cn.melon.mod.roll.RollRequest;
import cn.melon.view.admin.roll.IUpdateRollTable;
import cn.melon.view.admin.roll.RollInfoDialog;

public class RollInfoCtr implements ActionListener {
    
  private RollInfoDialog dialog = null;
    
    
    private RollRequest request;
    private IUpdateRollTable updateRollTable;

    public RollInfoCtr(RollInfoDialog dlg, IUpdateRollTable updateRollTable){
        this.dialog = dlg;
        this.updateRollTable = updateRollTable;
    }
    
    @Override
    public void actionPerformed(ActionEvent e) {
        switch (e.getActionCommand()) {
        case "保存":
            RollInfo info = dialog.getRollInfo();
            request = new RollRequest(updateRollTable);
            request.updateInfo(info,dialog.getStInfo());
            //libraryRequest.getAllBooks(dialog.getUpdateBookTable());
            dialog.setVisible(false);
            break;
        case "取消":
            dialog.setVisible(false);
            break;
        default:
            break;
        }
    }

}